package com.winit.feature.constants;

import java.util.HashMap;
import java.util.Map;

/**
 * feature顶级root的常量定义
 */
public abstract class FeatureRoot {

    private static Map<String, Class<?>> rootHolder = new HashMap<>();

    static {
        rootHolder.put(FeatureRootOpt.FEATURE_SYS, FeatureRootOpt.class);
        rootHolder.put(FeatureRootTom.FEATURE_SYS, FeatureRootTom.class);
        rootHolder.put(FeatureRootWho.FEATURE_SYS, FeatureRootWho.class);
    }

    public static String getRootFeatureId(String sys) throws Exception{
        Class clazz = rootHolder.get(sys);
        return (String) clazz.getDeclaredField("FEATURE_ID").get(clazz);
    }

    public static String getRootFeatureName(String sys) throws Exception{
        Class clazz = rootHolder.get(sys);
        return (String) clazz.getDeclaredField("FEATURE_NAME").get(clazz);
    }

}
